﻿package core.ui.controls
{
    import flash.events.*;
    import flash.text.*;

    public class ConfirmDialog extends Dialog
    {
        var okcallback:Function;
        var notokcallback:Function;

        public function ConfirmDialog(param1:Tuyitu, param2:String, param3:Function = null, param4:Function = null)
        {
            super(param1, "rm_confirm", 280, 135, true);
            this.okcallback = param3;
            this.notokcallback = param4;
            var _loc_5:* = new TextField();
            _loc_5.defaultTextFormat = new TextFormat("Verdana, Helvetica, San-serif", AppState.TextSize, 0);
            _loc_5.height = 50;
            _loc_5.width = 260;
            _loc_5.text = U.RM(param2);
            _loc_5.multiline = true;
            _loc_5.wordWrap = true;
            _loc_5.selectable = false;
            _loc_5.x = 10;
            _loc_5.y = 24;
            addChild(_loc_5);
            ok.title.text = U.RM("rm_yes");
            if (param4 != null)
            {
                notok = new Button("rm_no", 70);
                notok.addEventListener(MouseEvent.CLICK, this.NotOKClick, false, 0, true);
                notok.x = 119;
                notok.y = 98;
                addChild(notok);
            }
            ok.x = notok != null ? (39) : (119);
            ok.y = 98;
            cancel.x = 199;
            cancel.y = 98;
            return;
        }// end function

        override public function OKClick(event:MouseEvent) : void
        {
            Close();
            this.okcallback();
            return;
        }// end function

        public function NotOKClick(event:MouseEvent) : void
        {
            Close();
            this.notokcallback();
            return;
        }// end function

    }
}
